import 'dart:convert';

AssessmentRecordsGradesResult assessmentQuestionsResultFromJson(String str) =>
    AssessmentRecordsGradesResult.fromJson(json.decode(str));
String assessmentQuestionsResultToJson(AssessmentRecordsGradesResult data) =>
    json.encode(data.toJson());

class AssessmentRecordsGradesResult {
  AssessmentRecordsGradesResult({
    this.status,
    this.message,
    this.result,
  });

  int? status;
  String? message;
  AssessmentRecordsGrades? result;

  factory AssessmentRecordsGradesResult.fromJson(Map<String, dynamic> json) =>
      AssessmentRecordsGradesResult(
        status: json["status"],
        message: json["message"],
        result: json["result"] != null
            ? AssessmentRecordsGrades.fromJson(json["result"])
            : null,
      );

  Map<String, dynamic> toJson() => {
        "status": status,
        "message": message,
        "result": result?.toJson(),
      };
}

class AssessmentRecordsGrades {
  AssessmentRecordsGrades(
      {this.examEvalRecord,
      this.examBmRecord,
      this.examApRecord,
      this.examIbRecord,
      this.examLibRecord,
      this.examSsRecord,
      this.runningRecord});

  ExamEvalRecord? examEvalRecord;
  ExamRecord? examBmRecord;
  ExamRunningRecord? runningRecord;
  ExamRecord? examApRecord;
  ExamIbRecord? examIbRecord;
  ExamRecord? examLibRecord;
  ExamRecord? examSsRecord;

  factory AssessmentRecordsGrades.fromJson(Map<String, dynamic> json) =>
      AssessmentRecordsGrades(
        examEvalRecord: json["examEvalRecord"] != null
            ? ExamEvalRecord.fromJson(json["examEvalRecord"])
            : null,
        examBmRecord: json["examBmRecord"] != null
            ? ExamRecord.fromJson(json["examBmRecord"])
            : null,
        runningRecord: json["runningRecord"] != null
            ? ExamRunningRecord.fromJson(json["runningRecord"])
            : null,
        examApRecord: json["examApRecord"] != null
            ? ExamRecord.fromJson(json["examApRecord"])
            : null,
        examIbRecord: json["examIbRecord"] != null
            ? ExamIbRecord.fromJson(json["examIbRecord"])
            : null,
        examLibRecord: json["examLibRecord"] != null
            ? ExamRecord.fromJson(json["examLibRecord"])
            : null,
        examSsRecord: json["examSsRecord"] != null
            ? ExamRecord.fromJson(json["examSsRecord"])
            : null,
      );

  Map<String, dynamic> toJson() => {
        "examEvalRecord": examEvalRecord?.toJson(),
        "examBmRecord": examBmRecord?.toJson(),
        "runningRecord": runningRecord?.toJson(),
        "examApRecord": examApRecord?.toJson(),
        "examIbRecord": examIbRecord?.toJson(),
        "examLibRecord": examLibRecord?.toJson(),
        "examSsRecord": examSsRecord?.toJson(),
      };
}

class ExamRecord {
  ExamRecord({
    this.id,
    this.platform,
    this.userName,
    this.assessmentId,
    this.questionRecordId,
    this.writtenJson,
    this.oralJson,
    this.speechJson,
    this.translateJson,
    // this.writtenJsonList,
    // this.oralJsonList,
    // this.speechJsonList,
    this.commitTime,
  });

  String? id;
  String? platform;
  String? userName;
  String? assessmentId;
  String? questionRecordId;
  String? writtenJson;
  String? oralJson;
  String? speechJson;
  String? translateJson;
  // can get Json data from (writtenJson
  //: "[{\"number\":1,\"score\":9,\"questionId\":\"a3643773-17e5-45b4-86ed-46384204efb3\",\"comment\":\"100\"}]")
  // List<Grade>? writtenJsonList;
  // List<Grade>? oralJsonList;
  // List<Grade>? speechJsonList;
  int? commitTime;

  factory ExamRecord.fromJson(Map<String, dynamic> json) => ExamRecord(
        id: json["id"],
        platform: json["platform"],
        userName: json["userName"],
        assessmentId: json["assessmentId"],
        questionRecordId: json["questionRecordId"],
        writtenJson: json["writtenJson"],
        oralJson: json["oralJson"],
        speechJson: json["speechJson"],
        translateJson: json["translateJson"],
        // writtenJsonList: json["writtenJson"] != null
        //     ? List<Grade>.from(
        //         json["writtenJson"].map((x) => Grade.fromJson(x)))
        //     : null,
        // oralJsonList: json["oralJson"] != null
        //     ? List<Grade>.from(json["oralJson"].map((x) => Grade.fromJson(x)))
        //     : null,
        // speechJsonList: json["speeckJson"] != null
        //     ? List<Grade>.from(json["speechJson"].map((x) => Grade.fromJson(x)))
        //     : null,
        commitTime: json["commitTime"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "platform": platform,
        "userName": userName,
        "assessmentId": assessmentId,
        "questionRecordId": questionRecordId,
        "writtenJson": writtenJson,
        "oralJson": oralJson,
        // "writtenJsonList": writtenJsonList != null
        //     ? List<dynamic>.from(writtenJsonList!.map((x) => x.toJson()))
        //     : null,
        // "oralJsonList": oralJsonList != null
        //     ? List<dynamic>.from(oralJsonList!.map((x) => x.toJson()))
        //     : null,
        // "speechJsonList": speechJsonList != null
        //     ? List<dynamic>.from(speechJsonList!.map((x) => x.toJson()))
        //     : null,
        "commitTime": commitTime,
      };
}

class ExamEvalRecord {
  ExamEvalRecord({
    this.id,
    this.platform,
    this.userName,
    this.assessmentId,
    this.questionRecordId,
    this.level,
    this.bookCode,
    this.listeningCorrect,
    this.listeningTotal,
    this.listeningJson,
    this.readingCorrect,
    this.readingTotal,
    this.readingJson,
    this.writtenJson,
    this.oralJson,
    this.speechJson,
    this.skillJson,
    this.commitTime,
  });

  String? id;
  String? platform;
  String? userName;
  String? assessmentId;
  String? questionRecordId;
  int? level;
  String? bookCode;
  int? listeningCorrect;
  int? listeningTotal;
  String? listeningJson;
  int? readingCorrect;
  int? readingTotal;
  String? readingJson;
  String? writtenJson;
  String? oralJson;
  String? speechJson;
  String? skillJson;
  int? commitTime;

  factory ExamEvalRecord.fromJson(Map<String, dynamic> json) => ExamEvalRecord(
        id: json["id"],
        platform: json["platform"],
        userName: json["userName"],
        assessmentId: json["assessmentId"],
        questionRecordId: json["questionRecordId"],
        level: json["level"],
        bookCode: json["bookCode"],
        listeningCorrect: json["listeningCorrect"],
        listeningTotal: json["listeningTotal"],
        listeningJson: json["listeningJson"],
        readingCorrect: json["readingCorrect"],
        readingTotal: json["readingTotal"],
        readingJson: json["readingJson"],
        writtenJson: json["writtenJson"],
        oralJson: json["oralJson"],
        speechJson: json["speechJson"],
        skillJson: json["skillJson"],
        commitTime: json["commitTime"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "platform": platform,
        "userName": userName,
        "assessmentId": assessmentId,
        "questionRecordId": questionRecordId,
        "level": level,
        "bookCode": bookCode,
        "listeningCorrect": listeningCorrect,
        "listeningTotal": listeningTotal,
        "listeningJson": listeningJson,
        "readingCorrect": readingCorrect,
        "readingTotal": readingTotal,
        "readingJson": readingJson,
        "writtenJson": writtenJson,
        "oralJson": oralJson,
        "speechJson": speechJson,
        "skillJson": skillJson,
        "commitTime": commitTime,
      };
}

class ExamRunningRecord {
  ExamRunningRecord({
    this.substitution,
    this.mcTotal,
    this.accuracyRate,
    this.className,
    this.repetition,
    this.selfCorrectionSyntax,
    this.title,
    this.platform,
    this.oralJson,
    this.selfCorrection,
    this.classId,
    this.errorsMeaning,
    this.commitTime,
    this.id,
    this.incorrectIntonation,
    this.oralTotal,
    this.questionRecordId,
    this.assessmentId,
    this.omission,
    this.textTotal,
    this.oralScore,
    this.teacherName,
    this.selfCorrectionMeaning,
    this.mcCorrect,
    this.selfCorrectionVisual,
    this.userName,
    this.errorsSyntax,
    this.incorrectIntonationTonal,
    this.errorsVisual,
    this.studentName,
    this.comment,
    this.insertion,
    this.fluencyScore,
    this.errorsJson,
    this.msvtErrorsJson,
    this.submit,
  });

  int? substitution;
  int? mcTotal;
  int? accuracyRate;
  String? className;
  int? repetition;
  int? selfCorrectionSyntax;
  String? title;
  String? platform;
  String? oralJson;
  int? selfCorrection;
  String? classId;
  int? errorsMeaning;
  int? commitTime;
  String? id;
  int? incorrectIntonation;
  int? oralTotal;
  String? questionRecordId;
  String? assessmentId;
  int? omission;
  int? textTotal;
  int? oralScore;
  String? teacherName;
  int? selfCorrectionMeaning;
  int? mcCorrect;
  int? selfCorrectionVisual;
  String? userName;
  int? errorsSyntax;
  int? incorrectIntonationTonal;
  int? errorsVisual;
  String? studentName;
  String? comment;
  int? insertion;
  int? fluencyScore;
  String? errorsJson;
  String? msvtErrorsJson;
  bool? submit;

  factory ExamRunningRecord.fromJson(Map<String, dynamic> json) =>
      ExamRunningRecord(
        substitution: json['substitution'],
        mcTotal: json['mcTotal'],
        accuracyRate: json['accuracyRate'],
        className: json['className'],
        repetition: json['repetition'],
        selfCorrectionSyntax: json['selfCorrectionSyntax'],
        title: json['title'],
        platform: json['platform'],
        oralJson: json['oralJson'],
        selfCorrection: json['selfCorrection'],
        classId: json['classId'],
        errorsMeaning: json['errorsMeaning'],
        commitTime: json['commitTime'],
        id: json['id'],
        incorrectIntonation: json['incorrectIntonation'],
        oralTotal: json['oralTotal'],
        questionRecordId: json['questionRecordId'],
        assessmentId: json['assessmentId'],
        omission: json['omission'],
        textTotal: json['textTotal'],
        oralScore: json['oralScore'],
        teacherName: json['teacherName'],
        selfCorrectionMeaning: json['selfCorrectionMeaning'],
        mcCorrect: json['mcCorrect'],
        selfCorrectionVisual: json['selfCorrectionVisual'],
        userName: json['userName'],
        errorsSyntax: json['errorsSyntax'],
        incorrectIntonationTonal: json['incorrectIntonationTonal'],
        errorsVisual: json['errorsVisual'],
        studentName: json['studentName'],
        comment: json['comment'],
        insertion: json['insertion'],
        fluencyScore: json['fluencyScore'],
        errorsJson: json['errorsJson'],
        msvtErrorsJson: json['msvtErrorsJson'],
        submit: false,
      );

  Map<String, dynamic> toJson() => {
        'substitution': substitution,
        'mcTotal': mcTotal,
        'accuracyRate': accuracyRate,
        'className': className,
        'repetition': repetition,
        'selfCorrectionSyntax': selfCorrectionSyntax,
        'title': title,
        'platform': platform,
        'oralJson': oralJson,
        'selfCorrection': selfCorrection,
        'classId': classId,
        'errorsMeaning': errorsMeaning,
        'commitTime': commitTime,
        'id': id,
        'incorrectIntonation': incorrectIntonation,
        'oralTotal': oralTotal,
        'questionRecordId': questionRecordId,
        'assessmentId': assessmentId,
        'omission': omission,
        'textTotal': textTotal,
        'oralScore': oralScore,
        'teacherName': teacherName,
        'selfCorrectionMeaning': selfCorrectionMeaning,
        'mcCorrect': mcCorrect,
        'selfCorrectionVisual': selfCorrectionVisual,
        'userName': userName,
        'errorsSyntax': errorsSyntax,
        'incorrectIntonationTonal': incorrectIntonationTonal,
        'errorsVisual': errorsVisual,
        'studentName': studentName,
        'comment': comment,
        'insertion': insertion,
        'fluencyScore': fluencyScore,
        'errorsJson': errorsJson,
        'msvtErrorsJson': msvtErrorsJson,
        'submit': submit,
      };
}

class ExamIbRecord {
  ExamIbRecord({
    this.className,
    this.title,
    this.platform,
    this.oralJson,
    this.classId,
    this.commitTime,
    this.id,
    this.questionRecordId,
    this.assessmentId,
    this.userName,
    this.studentName,
    this.submit,
  });

  String? className;
  String? title;
  String? platform;
  String? oralJson;
  String? classId;
  int? commitTime;
  String? id;
  String? questionRecordId;
  String? assessmentId;
  String? userName;
  String? studentName;
  bool? submit;

  factory ExamIbRecord.fromJson(Map<String, dynamic> json) =>
      ExamIbRecord(
        className: json['className'],
        title: json['title'],
        platform: json['platform'],
        oralJson: json['oralJson'],
        classId: json['classId'],
        commitTime: json['commitTime'],
        id: json['id'],
        questionRecordId: json['questionRecordId'],
        assessmentId: json['assessmentId'],
        userName: json['userName'],
        studentName: json['studentName'],
        submit: false,
      );

  Map<String, dynamic> toJson() => {
    'className': className,
    'title': title,
    'platform': platform,
    'oralJson': oralJson,
    'classId': classId,
    'commitTime': commitTime,
    'id': id,
    'questionRecordId': questionRecordId,
    'assessmentId': assessmentId,
    'userName': userName,
    'studentName': studentName,
    'submit': submit,
  };
}

class Grade {
  Grade({
    this.number,
    this.score,
    this.questionId,
    this.comment,
  });
  String? number;
  String? score;
  String? questionId;
  String? comment;

  factory Grade.fromJson(Map<String, dynamic> json) => Grade(
        number: json["number"],
        score: json["score"],
        questionId: json["questionId"],
        comment: json["comment"],
      );

  Map<String, dynamic> toJson() => {
        "number": number,
        "score": score,
        "questionId": questionId,
        "comment": comment,
      };
}
